$(function () {
    //完成按钮
    $("#over").click(function () {
        //验证设置密码是否符合标准
        var over=true;
        if(!/^(?=.*[0-9])(?=.*[a-zA-Z])(.{8,})$/.test($("#password").val().trim())){
            $.toast("密码输入格式错误","text");
            over=false;
            return ;
        };
        if($("#password").val().trim()===$("#passwordAgain").val().trim()){
            AjaxRequest({
                url:_url+"/money/login/forgetpwd",
                load:true,
                data:{
                    accountnumber:JSON.parse(sessionStorage.username),
                    password:$("#passwordAgain").val().trim()
                },
                type:"post",
                success(res){
                    if(isReqSucceed(res)){
                        $(window).attr("location","./resetPwdSuccess.html");
                    }
                }
            });
        }else{
            $.toast("密码前后不一致","text")
        }
    });
    //密码是否可见切换
    $("#visible01").click(function () {
        var change=$(this)
        if(change.data("change")==="invisible"){
            change.attr("src","../../public/images/hide.png")
            change.data("change","")
            change.prev().attr("type","text")
        }else{
            change.attr("src","../../public/images/show.png")
            change.data("change","invisible");
            change.prev().attr("type","password")
        }
    })
    $("#visible02").click(function () {
        var change=$(this)
        if(change.data("change")==="invisible"){
            change.attr("src","../../public/images/hide.png")
            change.data("change","")
            change.prev().attr("type","text")
        }else{
            change.attr("src","../../public/images/show.png")
            change.data("change","invisible");
            change.prev().attr("type","password")
        }
    })
    //
})